<?php

namespace App\Model;

use App\Common\Model\ShopAccount;
use Illuminate\Database\Eloquent\Model;
class CashRecord extends Model
{
    //时间戳维护开关
    public $timestamps = false;
    //与数据表关联
    protected $table = 'cash_records';
    //批量赋值字段
    //查询uid对应的用户name
    protected $fillable = [
        'uid',
        'amount',
        'account',
        'account_name',
        'status',
        'create_time',
        'update_time'
    ];
    public function getUidName(){
        return self::hasOne(ShopAccount::class,'uid','uid')->withDefault([
            'name'=>'未知'
        ]);
    }
}
